package xyz.csmcool.imoss.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import xyz.csmcool.imoss.entity.OssConfig;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author csmcool
 * @since 2022-08-05
 */
@Mapper
public interface OssConfigMapper extends BaseMapper<OssConfig> {

    /**
     * 得到选择的oss
     * @return
     */
    @Select("SELECT oss_type FROM `sjim_oss_config` WHERE is_active = 1 LIMIT 1")
    Integer getOssType();

    /**
     * 得到ossConfig
     * @return
     */
    @Select("SELECT id,oss_type ossType,secretId,secretKey,region,bucket_name bucketName," +
            "url,prefix,is_active isActive,create_time createTime,update_time updateTime " +
            "FROM sjim_oss_config WHERE is_active=1 LIMIT 1")
    OssConfig selectConfig();
}
